package com.central.common.feign

import com.central.common.constant.ServiceNameConstants
import com.central.common.enum.LikeTypeEnum
import com.central.common.feign.fallback.AttentionServiceFallbackFactory
import com.central.common.feign.fallback.LikeServiceFallbackFactory
import com.central.common.feign.fallback.VisitServiceFallbackFactory
import com.central.common.model.RealDataResult
import org.springframework.cloud.openfeign.FeignClient
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestParam

/**
 * @author  fly
 * @date  2021/5/27 17:26
 * @version 1.0
 */
@FeignClient(name = ServiceNameConstants.REAL_SERVICE, fallbackFactory = LikeServiceFallbackFactory::class, decode404 = true)
interface LikeService {


    /**
     * 获取点赞个数
     */
    @GetMapping("/like/getLikeNum/{likeId}")
    fun getLikeNum(
        @PathVariable("likeId") likeId: Long,
        @RequestParam("likeTypeEnum") likeTypeEnum: LikeTypeEnum
    ): RealDataResult


    /**
     * 是否点赞
     */
    @PostMapping("/like/booleanLike", params = ["likeId", "userId", "likeTypeEnum"])
    fun booleanLike(
        @RequestParam("likeId") likeId: Long,
        @RequestParam("userId") userId: Long,
        @RequestParam("likeTypeEnum") likeTypeEnum: LikeTypeEnum
    ): RealDataResult
}
